<template>
  <div class="ListContentIndexMain">
    <div class="contentIndexMain">
      <div class="contentIndexMainTitle"><el-skeleton :rows="0" animated v-if="skeletonTopType"/>{{ dataList.title }}</div>
      <div class="contentIndexMainTime"><el-skeleton :rows="0" animated v-if="skeletonTopType"/>{{ dataList.creationtime }} 【预览】{{ dataList.flow }} 次</div>
      <el-skeleton :rows="6" animated v-if="skeletonTopType"/>
      <div v-highlight class="contentIndexMainText" v-html="dataList.content"></div>
    </div>
  </div>
</template>
<script>
import Interface from './serve/api';
export default {
  // 内容页
  name: 'contentIndex',
  data () {
    return {
      dataList: '',
      skeletonTopType: true,
    }
  },
  mounted () {
    this.getNotearticleIdTitle();
  },
  methods: {
    // 查询内容
    getNotearticleIdTitle () {
      let params = {
        id: this.$route.query.id,
      };
      Interface.getNotearticleIdTitle(params).then(res => {
        if (res.status === 200) {
          this.skeletonTopType = false;
          this.dataList = res.data[0];
          this.postNotearticleUpdateFflow (res.data[0].flow);
        }
      })
    },

    // 记录访问量
    postNotearticleUpdateFflow (flow) {
      let params = {
        id: this.$route.query.id,
        flow: flow,
      };
      Interface.postNotearticleUpdateFflow(params).then(res => {

      })
    },
  },
}
</script>
